package org.zfes.snowier.cloud.zbss.pmp.router.service.pub;

import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.ComboboVo;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpDeduceLine;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpDifficultyScore;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpProjectVersion;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpDassessModelService;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpDeduceLineService;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpDifficultyScoreService;
@Controller("org.zfes.snowier.cloud.zbss.pmp.router.service.pub.pmpALineController")
@RequestMapping("/pmp/service/pub/pmpALine")
public class PmpALineController extends BaseController {

	
	@Autowired
	private IPmpDeduceLineService pmpDeduceLineService;
	@Autowired
	private IPmpDifficultyScoreService pmpDifficultyScoreService;
	
	@Autowired
	private IPmpDassessModelService pmpDassessModelService;
	
//============================================================	 	
	  @RequestMapping(value="/loadDeduceLineDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    public @ResponseBody  Object loadDeduceLineDataSet(@RequestParam Map<String,Object> params){
	        DataSet dataSet=  pmpDeduceLineService.loadPmpDeduceLineDataSet(params);
	        return ajaxQuery("dataSet", dataSet);
	    }
	  @RequestMapping(value="/loadDeduceLine", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    public @ResponseBody  Object DeduceLine(Long id){
	    	 Optional<PmpDeduceLine>  pmpDeduceLine=  pmpDeduceLineService.loadPmpDeduceLineById(id);
	    	return ajaxQuery("deduceLine", pmpDeduceLine);
	    }
	  
//============================================================	 	  
	
	  	@RequestMapping(value="/loadDifScoreDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    public @ResponseBody  Object loadDifficultyScoreDataSet(@RequestParam Map<String,Object> params){
	        DataSet dataSet=  pmpDifficultyScoreService.loadPmpDifficultyScoreDataSet(params);
	        return ajaxQuery("dataSet", dataSet);
	    }
	  	@RequestMapping(value="/loadDifScore", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	    public @ResponseBody  Object loadDifScore(Long id){
	    	 Optional<PmpDifficultyScore>  difScore=  pmpDifficultyScoreService.loadPmpDifficultyScoreById(id);
	    	return ajaxQuery("difScore", difScore);
	    }
//============================================================	  
	  
	  
    @RequestMapping(value="/loadDeduceLineComboboVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadDeduceLineComboboVo(Long projectId,Boolean firstEmpty){
		 List<ComboboVo>  vo=pmpDeduceLineService.loadComboboVo(projectId, firstEmpty);
		 
	    return ajaxQuery("comboboVo", vo);
    }
    
    @RequestMapping(value="/loadDifScoreComboboVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadDifScoreComboboVo(Boolean firstEmpty){
		 List<ComboboVo>  vo=pmpDifficultyScoreService.loadComboboVo(firstEmpty);
	    return ajaxQuery("comboboVo", vo);
    }
    @RequestMapping(value="/loadDassessModelComboboVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadDassessModelComboboVo(Boolean firstEmpty){
		 List<ComboboVo>  vo=pmpDassessModelService.loadComboboVo(firstEmpty);
	    return ajaxQuery("comboboVo", vo);
    }

}